<route lang="json5" type="page">
  {
    layout: 'default',
    style: {
      navigationBarTitleText: '示例',
    },
  }
</route>

<template>
  <view class="page">
    <gi-wf-page :record-list="recordList" workflow-image-url="">
      <gi-form ref="GiFormRef" v-model="form" :columns="columns"></gi-form>

      <gi-gap></gi-gap>

      <gi-fixed-footer>
        <sar-button type="mild">保存</sar-button>
        <sar-button type="default" @click="submit">提交</sar-button>
      </gi-fixed-footer>
    </gi-wf-page>
  </view>
</template>

<script lang='ts' setup>
import type { GiFormInstance } from '@/components/gi-form/type'
import { useFormColumns } from './hooks/useFormColumns'

const form = reactive({
  name: '',
  phone: '',
  num: 2,
  star: 3,
  slider: 10,
})

const GiFormRef = ref<GiFormInstance>()

const { columns } = useFormColumns()

async function submit() {
  try {
    await GiFormRef.value?.formRef.validate()
    uni.showToast({ title: '校验成功', icon: 'none' })
  }
  catch (error) {
    console.log('error', error)
  }
}

const recordList = [
  {
    finished: false,
    taskId: '3616374136176385',
    taskName: '安环部鉴定',
    auditUsername: ' *强 *雪梅 *冬冬 *小刚 *仕平',
    auditDeptName: null,
    createTime: '2024-10-30 19:14:55',
    endTime: null,
    claimTime: null,
    auditMessage: '',
    auditUserId: '1744285753952239616 1744286132785971200 1744286247957364736 1744286422402662400 1744286558428135424',
    taskDefinitionKey: 'task2',
    addUserNodeType: 0,
  },
  {
    finished: true,
    taskId: '3616374135619330',
    taskName: '不符合项登记',
    auditUsername: ' *级管理员',
    auditDeptName: '生产技术部',
    createTime: '2024-10-30 19:14:55',
    endTime: '2024-10-30 19:14:55',
    claimTime: '2024-10-30 19:14:55',
    auditMessage: '',
    auditUserId: 'adminuserid',
    taskDefinitionKey: 'task1',
    addUserNodeType: 0,
  },
  {
    finished: true,
    taskId: null,
    taskName: '启动',
    auditUsername: '*级管理员',
    auditDeptName: '生产技术部',
    createTime: '2024-10-30 19:14:55',
    endTime: null,
    claimTime: null,
    auditMessage: '',
    auditUserId: 'adminuserid',
    taskDefinitionKey: null,
    addUserNodeType: 0,
  },
]
</script>

<style lang='scss' scoped>

</style>
